﻿#region Copyright 
/*-------------------------------------------------------------------------
* 命名空间名称/文件名:    SSPivot.Common/AppContextProvider 
* CLR版本:     4.0.30319.42000
* 机器名称:    DESKTOP-NHMLO8A
* 功 能：       N/A
* 类 名：       AppContextProvider
* 创建时间：  2025/5/22 15:57:12
* 版本号：      v1.0
* 创建人:        xulong
*-------------------------------------------------------------------------*/
#endregion
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SSPivot.Common
{
    public class AppContextProvider
    {
        #region 单例
        private static AppContextProvider instance = AppDependencyResolver.Current.GetService<AppContextProvider>();
        public static AppContextProvider Current { get { return instance; } }
        #endregion 
        public IWebHostEnvironment WebHostEnvironment { get; set; }
        public IHttpContextAccessor HttpContextAccessor { get; set; }
        public HttpContext HttpContext { get { return HttpContextAccessor.HttpContext; } }
        public ILoggerFactory LoggerFactory { get; set; }
        public ILogger<AppContextProvider> Logger { get; set; }
        public IConfiguration Configuration { get; set; } 
        public IConfiguration AppSettings { get { return Configuration.GetSection("AppSettings"); } }
    }
}
